package com.nicy.dream.utils;

/**
 * @description:
 * @projectName:dream
 * @see:com.nicy.dream.utils
 * @author:NicyYe
 * @createTime:2021/2/5 10:46
 * @version:1.0
 */
public interface DistributedLock {

    //超时时间
    long TIMEOUT_MILLIS = 3000;

    int RETRY_TIMES = 2;

    //睡眠时间
    long SLEEP_MILLIS = 500;

    boolean lock(String key);

    boolean lock(String key,int retryTime,long sleepMillis);

    boolean lock(String key,long expire);

    boolean lock(String key,long expire,int retryTime);

    boolean lock(String key,long expire,int retryTimes,long sleepMillis);

    //解锁
    boolean releaseLock(String key);
}
